<%@page import="com.yunhuakeji.wddx.utils.IsNull"%>
<%@page import="net.sf.json.JSONObject"%>
<%@page import="net.sf.json.JSONArray"%>
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
JSONObject obj ;
try{
    obj = JSONObject.fromObject(request.getAttribute("result"));
    /* System.out.println(obj.toString()); */
}
catch(Exception e){
    obj = null;
}
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    <title>测评结果</title>
     <meta name="viewport" content="width=device-width,initial-scale=1.0,user-scalable=no,minimum-scale=1.0,maximum-scale=1.0">
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<link rel="stylesheet" type="text/css" href="css/myreport.css">
	<script src="js/jquery.min.js"></script>
	<script src="js/myReport.js"></script>
	<script src="js/layer.js"></script>
  </head>
  <style>
  	
  </style>
  <body>
  <%if(!obj.isNullObject()){
      
   %>
  	<!-- home -->
  	<div class="report-header">
  			<a>测评结果</a>
  	</div>
  	<div class="report-menu">
  		<!-- 标题 -->
  		<div>
	  		<span class="career_conclusion_pic"><img src="images/careerQuiz_conclusion.png"></span>
	  		<a class="career_conclusion_char">结论:<span style="color:#5cbae4;"><%=obj.getString("describe") %></span></a>
	  		<div class="clear padding-clear"></div>
	  	</div>
	  	<!-- 进度条 -->
  		<div class="carreer-pic">
  		<!-- 副标题 -->
  			<a class="disblock text-center">MBTI倾向示意图(类型:<%=obj.getString("type") %>)</a>
  			<div class="pl5 pr5" id="percentage">
	  	<!--状态显示 -->
	  			<a>
		  			<span></span>
		  			<span>
		  				<span>轻微</span>
		  				<span>中等</span>
		  				<span>明显</span>
		  				<span>强</span>
		  			</span>
	  				<span></span>
	  				<div class="clear"></div>
	  			</a>
  			</div>
  		</div>
  		<!-- 描述 -->
  		<div class="carreer-describe">
  			<%=obj.getString("character") %>
  		</div>
  		<!-- 推荐和建议 -->
  		<div class="mt10 mb10 carreer-proposal">
  			<a><img src="images/careerQuiz_proposal.png"></a>
  			<a>推荐职业及现实建议:</a>
  		</div>
  		<!-- 推荐和建议表格 -->
  		<table class="standard">
  			<tbody>
	  			<tr>
	  				<td>所属行业</td>
	  				<td>职业推荐</td>
	  				<td>推荐岗位</td>
	  			</tr>
	  			<%JSONArray advice = obj.getJSONArray("advice"); for(int i=0;i<advice.size();i++){
	  			  JSONObject industry = advice.getJSONObject(i);
	  			  JSONArray profession= industry.getJSONArray("profession");
	  			  int rows = profession.size();
	  			 %>
	  			     <tr>
		  				<td rowspan=<%=rows %>><%=industry.getString("industry") %></td>
		  				<td><%=profession.getJSONObject(0).getString("profession_name") %></td>
		  				<%JSONArray job = profession.getJSONObject(0).getJSONArray("job"); for(int k=0;k<job.size();k++){ %>
		  				<td><a href="careerQuiz/careerQuiz_mbxq.jsp?targetId=<%=job.getJSONObject(k).getString("job_id") %>&user_id=<%=request.getParameter("userid")%>&ticket=<%=request.getParameter("ticket")%>"><%=job.getJSONObject(k).getString("job_name") %></a></td>
		  				<%} %>
	  			     </tr>
	  			     <%for(int j=1;j<profession.size();j++){ %>
	  			     <tr>
	  			        <td><%=profession.getJSONObject(j).getString("profession_name") %></td>
	  				    <%JSONArray job1 = profession.getJSONObject(0).getJSONArray("job"); for(int m=0;m<job.size();m++){ %>
		  				<td><a href="careerQuiz/careerQuiz_mbxq.jsp?targetId=<%=job.getJSONObject(m).getString("job_id") %>&user_id=<%=request.getParameter("userid")%>&ticket=<%=request.getParameter("ticket")%>"><%=job1.getJSONObject(m).getString("job_name") %></a></td>
		  				<%} %>
	  			     </tr>
	  			     <%} %>
	  			<%} %>
  			</tbody>
  		</table>
  	</div>
  	<script>
  	var report = new myReport();
	var user_id = '<%=request.getParameter("userid")%>';
	var ticket = '<%=request.getParameter("ticket")%>';
  	//控制百分比；
  	var bfb=<%=obj.getJSONArray("bfb")%>;
  	var fontsize=$('body').css("font-size").replace(/[^0-9]/ig, ""); //获取字体大小
  	var windowwidth=document.body.clientWidth;						//获取屏幕宽度
  	var pwidth=(windowwidth-(1+0.3125)*fontsize)*0.65-2;			//获取父div宽度
  		/* 判断屏幕宽度是否为大屏 */
	if(windowwidth > 736 ){
		pwidth = (1024-(1+0.3125)*fontsize)*0.65-2;	
	}
  	var html="";						
  	$.each(bfb,function(i,r){
  		var width = report.toPoint(r["bfb"])*pwidth;    					//换算比例宽度
  		var color = report.getrandcolor();							//获取随机颜色
  		var style = "background-color:"+color+";width:"+width+";";
  		html += '<a>'
	  				+'<span>'+r["xg"]+"("+r["dm"]+")"+'</span>'
	  				+'<span>'
		  				+'<span style='+style+' class="Percentage-color">'
		  				+'</span>'
	  				+'</span>'
	  				+'<span>'+r["bfb"]+'</span>'
	  				+'<div class="clear">'+'</div>'
  				+'</a>';
  	});
  	$('#percentage').prepend(html);
  	</script>
  	<%} %>
  	
  </body>
</html>
